#region System
using System;
using System.Collections.Generic;
using System.IO;
using CF.Framework.Engine.Drawing;
using CF.Framework.Engine.Misc;
using CF.Framework.Engine.Screens;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
#endregion

namespace CF.Framework.Engine.Controls
{
	public class TextureBox : ContextContainer
	{
		public TextureBox()
		{
		}

		protected override void OnDraw(GameTime gameTime, SpriteBatch spriteBatch)
		{
			base.OnDraw(gameTime, spriteBatch);

			if (OpacityMask != null)
			{
				spriteBatch.Draw(Context, this.ScaledPosition, null, Color.White, 0, Vector2.Zero, this.Scale, SpriteEffects.None, 0);

				if (Opacity != 255)
				{
					spriteBatch.Draw(this.OpacityMask, this.ScaledPosition, this.ScaledRectangle, new Color(this.Opacity, this.Opacity, this.Opacity, (byte)MathHelper.Clamp(this.Opacity, 0, 255)), 0, Vector2.Zero, this.Scale, SpriteEffects.None, 0);
				}
			}
			else
			{
				spriteBatch.Draw(Context, this.ScaledPosition, null, new Color(this.Opacity, this.Opacity, this.Opacity, (byte)MathHelper.Clamp(this.Opacity, 0, 255)), 0, Vector2.Zero, this.Scale, SpriteEffects.None, 0);
			}
		}
	}
}
